//
//  QQLoginVC.swift
//  QQZone
//
//  Created by haifeng on 16/4/28.
//  Copyright © 2016年 haifeng. All rights reserved.
//

import UIKit

class QQLoginVC: UIViewController {

    
    // 做动画的视图
    @IBOutlet weak var animatedView: UIView!
    
    // 记住密码
    @IBOutlet weak var rememberPwdBtn: UIButton!
    
    // 自动登录
    @IBOutlet weak var autoLoginBtn: UIButton!
    
    // 用户名
    @IBOutlet weak var accountTF: UITextField!
    
    // 密码
    @IBOutlet weak var passwordTF: UITextField!

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
}

extension QQLoginVC {


    @IBAction func login() {
        print("登录")
    }
    
    
    @IBAction func remberLogin(sender: AnyObject) {
        rememberPwdBtn.selected = !rememberPwdBtn.selected
        if !rememberPwdBtn.selected {
        autoLoginBtn.selected = false
        }
    }
    
    @IBAction func autoLogin(sender: AnyObject) {
        autoLoginBtn.selected = !autoLoginBtn.selected
        if autoLoginBtn.selected {
        rememberPwdBtn.selected = true
        }
    }
    
}

extension QQLoginVC : UITextFieldDelegate {
    func textFieldShouldReturn(textField: UITextField) -> Bool {
        if textField == accountTF {
          passwordTF.becomeFirstResponder()
        }
        
        if textField == passwordTF {
            textField.resignFirstResponder()
           login()
        
        }
//        dsfajsfask
        return true
//        sjcgascba
    }

}


// 专门放界面处理
extension QQLoginVC {
    override func preferredStatusBarStyle() -> UIStatusBarStyle {
        return .LightContent
    }
}
